import { routes, RouteType } from "./routes";
import React from "react";
import { Route, useRoutes } from "react-router-dom";

const routerView = (routes: RouteType[]) => {
  return routes.map((v, i) => {
    return (
      <Route path={v.path} element={v.element} key={i}>
        {v.children && routerView(v.children)}
      </Route>
    );
  });
};

const Index: React.FC = () => {
  const Routes = () => useRoutes(routes);
  return <Routes></Routes>;
};

export default Index;
